#lang racket

(define (deep-reverse items)
  (if (null? items)
      items
      (let ((last (if (pair? (car items))
                      (list (deep-reverse (car items)))
                      (list (car items)))))
        (append (deep-reverse (cdr items)) last))))

(define x (list (list 1 2) (list 3 4) (list 5 6) 7))

(deep-reverse x)